Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/typedefs #36

Merged
merged 23 commits into from
Jun 30, 2024
Merged

Feat/typedefs #36

merged 23 commits into from
Jun 30, 2024

Conversation

lostrepo
Copy link
Contributor

added lo type <config path> to autogenerate subset of types based on included embeds/libs/bindings (as much as possible)
replaced api schema typing imports with type comments
added optional array to hint optional params in api definitions
reduced amount of file rewrites with lo init and lo type <config path>

@lostrepo
Copy link
Contributor Author

lostrepo commented Jun 13, 2024

Edit: done*
Also we can add globals.d.ts, lib/globals.d.ts, lib/apis.all.d.ts to .gitignore since all info is in lib/types.js and all final type changes should go there
But must update symbols

@billywhizz
Copy link
Contributor

@lostrepo thanks for this! will take a look over the weekend. 🙏

@billywhizz
Copy link
Contributor

@lostrepo sorry - i had to push some changes up before i had a chance to review this. would you mind rebasing when you have a chance? i will get this merged over next couple days once i have had a look. 🙏

@lostrepo
Copy link
Contributor Author

rebased
resolved 1 merge conflict in main.js:

  • lo.load/lo.library return types according to lib/<lib_name>/api.js
  • but we override the object and need it typed like Core on lo.core

ideally, we should have 2 objects so real type of one returned by lo.load/lo.library remains unchanged => api.js based types and override types will correspond to separate js objects
but I don't know the cost of that so only added some variable handles with type casts for core in main.js
lib/<lib_name>.js files also have issue of changing object returned by lo.load

@lostrepo
Copy link
Contributor Author

Detected missing typedef on lo
image

lostrepo and others added 14 commits June 24, 2024 16:31
we use -std=c++17
./v8/include/v8-local-handle.h:401:30: error: template-id not allowed for constructor in C++20
use LO_WARN environment variable if breaking fixes like that are needed for local development
…hints

ts bails on intersections of complex types
few hardcoded consts still remain
replace Core.os: OS with Core.os: CurrentRuntimeGenerics['os']
later do the same for arch, engine so unreachable (lo.core[<runtime_generic>] === 'value') checks will be marked red by type checker and it'll infer correct types without us writing extra d.ts files
@billywhizz billywhizz merged commit 4356cdb into just-js:main Jun 30, 2024
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants